import http from "./http";
interface getList {
  email: "string";
  password: "string|number";
}
// 登陆
function getLogin(data: getList) {
  return http.post("/user/login", data);
}
// 专栏
interface getessay {
  page: number;
  size: number;
}
function getess(data:getessay){
return http.get(`/columns?currentPage=${data.page}&pageSize=${data.size}`)
}
// 进入专栏
interface list{
  id: "string";
  page:"string";
  size:"string";
}
function getList(data:list){
  return http.get(`/columns/${data.id}/posts?currentPage=${data.page}&pageSize=${data.size}`)
}
// 详情(
interface detail{
  id: "string"
}
function getDetail(data:detail){
  return http.get(`/posts/${data.id}`)
}
// 新建文章
interface addlist{
  title: "string",
  content: "string",
  image: "string",
  column: "string",
  author: "string"
}
function addList(data:addlist){
return http.post("/posts",data)
}
// 获取用户信息
function getinfo(){
  return http.get("/user/current")
}
// 我的专栏
interface  mylist{
  id:"string",
}
function mylists(id:mylist){
  return http.get(`/columns/${id}`)
}
export { getLogin ,getess,getList,getDetail,addList,getinfo,mylists};
